package com.esri.core.geometry;

import java.nio.ByteBuffer;

/* loaded from: classes.dex */
class OperatorImportFromESRIShapeCursor extends GeometryCursor {
    ByteBufferCursor a;
    int b;
    int c;
    int d = -1;

    public OperatorImportFromESRIShapeCursor(int i, int i2, ByteBufferCursor byteBufferCursor) {
        if (byteBufferCursor == null) {
            throw new GeometryException("invalid argument");
        }
        this.b = i;
        this.c = i2;
        this.a = byteBufferCursor;
    }

    @Override // com.esri.core.geometry.GeometryCursor
    public Geometry next() {
        ByteBuffer next = this.a.next();
        if (next != null) {
            this.d = this.a.getByteBufferID();
            return a(next);
        }
        return null;
    }

    @Override // com.esri.core.geometry.GeometryCursor
    public int getGeometryID() {
        return this.d;
    }

    /* JADX WARN: Removed duplicated region for block: B:47:0x0085 A[DONT_GENERATE] */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0089 A[Catch: all -> 0x00ed, TRY_ENTER, TryCatch #0 {all -> 0x00ed, blocks: (B:49:0x0089, B:54:0x0092, B:55:0x0097, B:56:0x0098, B:59:0x00a0, B:65:0x00ad, B:66:0x00b2, B:67:0x00b3, B:70:0x00bb, B:75:0x00c6, B:76:0x00cb, B:77:0x00cc, B:80:0x00d4, B:85:0x00df, B:86:0x00e4, B:87:0x00e5), top: B:94:0x0082 }] */
    /* JADX WARN: Removed duplicated region for block: B:59:0x00a0 A[Catch: all -> 0x00ed, TRY_ENTER, TryCatch #0 {all -> 0x00ed, blocks: (B:49:0x0089, B:54:0x0092, B:55:0x0097, B:56:0x0098, B:59:0x00a0, B:65:0x00ad, B:66:0x00b2, B:67:0x00b3, B:70:0x00bb, B:75:0x00c6, B:76:0x00cb, B:77:0x00cc, B:80:0x00d4, B:85:0x00df, B:86:0x00e4, B:87:0x00e5), top: B:94:0x0082 }] */
    /* JADX WARN: Removed duplicated region for block: B:70:0x00bb A[Catch: all -> 0x00ed, TRY_ENTER, TryCatch #0 {all -> 0x00ed, blocks: (B:49:0x0089, B:54:0x0092, B:55:0x0097, B:56:0x0098, B:59:0x00a0, B:65:0x00ad, B:66:0x00b2, B:67:0x00b3, B:70:0x00bb, B:75:0x00c6, B:76:0x00cb, B:77:0x00cc, B:80:0x00d4, B:85:0x00df, B:86:0x00e4, B:87:0x00e5), top: B:94:0x0082 }] */
    /* JADX WARN: Removed duplicated region for block: B:80:0x00d4 A[Catch: all -> 0x00ed, TRY_ENTER, TryCatch #0 {all -> 0x00ed, blocks: (B:49:0x0089, B:54:0x0092, B:55:0x0097, B:56:0x0098, B:59:0x00a0, B:65:0x00ad, B:66:0x00b2, B:67:0x00b3, B:70:0x00bb, B:75:0x00c6, B:76:0x00cb, B:77:0x00cc, B:80:0x00d4, B:85:0x00df, B:86:0x00e4, B:87:0x00e5), top: B:94:0x0082 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private com.esri.core.geometry.Geometry a(java.nio.ByteBuffer r15) {
        /*
            Method dump skipped, instructions count: 292
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.geometry.OperatorImportFromESRIShapeCursor.a(java.nio.ByteBuffer):com.esri.core.geometry.Geometry");
    }

    /* JADX WARN: Code restructure failed: missing block: B:122:0x02de, code lost:
        if (r14 == false) goto L194;
     */
    /* JADX WARN: Code restructure failed: missing block: B:157:0x039a, code lost:
        if (r8 == false) goto L165;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private com.esri.core.geometry.Geometry a(boolean r36, int r37, java.nio.ByteBuffer r38) {
        /*
            Method dump skipped, instructions count: 1234
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.geometry.OperatorImportFromESRIShapeCursor.a(boolean, int, java.nio.ByteBuffer):com.esri.core.geometry.Geometry");
    }

    /* JADX WARN: Code restructure failed: missing block: B:55:0x014b, code lost:
        if (r11 == false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:79:0x01b9, code lost:
        if (r11 == false) goto L53;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    private com.esri.core.geometry.Geometry a(int r27, java.nio.ByteBuffer r28) {
        /*
            Method dump skipped, instructions count: 617
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.esri.core.geometry.OperatorImportFromESRIShapeCursor.a(int, java.nio.ByteBuffer):com.esri.core.geometry.Geometry");
    }

    private Geometry b(int i, ByteBuffer byteBuffer) {
        int i2;
        OperatorImportFromESRIShapeCursor operatorImportFromESRIShapeCursor;
        int i3;
        boolean z;
        int i4;
        int i5;
        boolean z2 = (i & Integer.MIN_VALUE) != 0;
        boolean z3 = (i & 1073741824) != 0;
        boolean z4 = ((i & i) & ShapeModifiers.ShapeHasIDs) != 0;
        double d = byteBuffer.getDouble(4);
        double d2 = byteBuffer.getDouble(12);
        int i6 = 20;
        boolean isNaN = NumberUtils.isNaN(d);
        double NaN = NumberUtils.NaN();
        if (z2) {
            NaN = Interop.translateFromAVNaN(byteBuffer.getDouble(20));
            i6 = 28;
        }
        double d3 = NaN;
        double NaN2 = NumberUtils.NaN();
        if (z3) {
            NaN2 = Interop.translateFromAVNaN(byteBuffer.getDouble(i6));
            i6 += 8;
        }
        if (z4) {
            int i7 = byteBuffer.getInt(i6);
            operatorImportFromESRIShapeCursor = this;
            i2 = i7;
        } else {
            i2 = -1;
            operatorImportFromESRIShapeCursor = this;
        }
        int i8 = operatorImportFromESRIShapeCursor.c;
        if (i8 == 8710) {
            MultiPoint multiPoint = new MultiPoint();
            MultiPointImpl multiPointImpl = (MultiPointImpl) multiPoint._getImpl();
            int i9 = i2;
            if (isNaN) {
                z = z4;
                i4 = 1;
                i5 = 0;
            } else {
                i4 = 1;
                i5 = 0;
                AttributeStreamBase createAttributeStreamWithSemantics = AttributeStreamBase.createAttributeStreamWithSemantics(0, 1);
                z = z4;
                AttributeStreamOfDbl attributeStreamOfDbl = (AttributeStreamOfDbl) createAttributeStreamWithSemantics;
                attributeStreamOfDbl.write(0, d);
                attributeStreamOfDbl.write(1, d2);
                multiPointImpl.setAttributeStreamRef(0, createAttributeStreamWithSemantics);
                multiPointImpl.resize(1);
            }
            if (z2) {
                multiPointImpl.addAttribute(i4);
                if (!isNaN && !VertexDescription.isDefaultValue(i4, d3)) {
                    AttributeStreamBase createAttributeStreamWithSemantics2 = AttributeStreamBase.createAttributeStreamWithSemantics(i4, i4);
                    createAttributeStreamWithSemantics2.writeAsDbl(i5, d3);
                    multiPointImpl.setAttributeStreamRef(i4, createAttributeStreamWithSemantics2);
                }
            }
            if (z3) {
                multiPointImpl.addAttribute(2);
                if (!isNaN && !VertexDescription.isDefaultValue(2, NaN2)) {
                    AttributeStreamBase createAttributeStreamWithSemantics3 = AttributeStreamBase.createAttributeStreamWithSemantics(2, i4);
                    createAttributeStreamWithSemantics3.writeAsDbl(0, NaN2);
                    multiPointImpl.setAttributeStreamRef(2, createAttributeStreamWithSemantics3);
                }
            }
            if (z) {
                multiPointImpl.addAttribute(3);
                if (!isNaN && !VertexDescription.isDefaultValue(3, i9)) {
                    AttributeStreamBase createAttributeStreamWithSemantics4 = AttributeStreamBase.createAttributeStreamWithSemantics(3, 1);
                    createAttributeStreamWithSemantics4.writeAsInt(0, i9);
                    multiPointImpl.setAttributeStreamRef(3, createAttributeStreamWithSemantics4);
                }
            }
            return multiPoint;
        }
        boolean z5 = z4;
        int i10 = i2;
        if (i8 == 3077) {
            Envelope envelope = new Envelope();
            double d4 = NaN2;
            envelope.setCoords(d, d2, d, d2);
            if (z2) {
                Envelope1D envelope1D = new Envelope1D();
                envelope1D.vmin = d3;
                envelope1D.vmax = d3;
                envelope.addAttribute(1);
                i3 = 0;
                envelope.a(1, 0, envelope1D);
            } else {
                i3 = 0;
            }
            if (z3) {
                Envelope1D envelope1D2 = new Envelope1D();
                envelope1D2.vmin = d4;
                envelope1D2.vmax = d4;
                envelope.addAttribute(2);
                envelope.a(2, i3, envelope1D2);
            }
            if (z5) {
                Envelope1D envelope1D3 = new Envelope1D();
                double d5 = i10;
                envelope1D3.vmin = d5;
                envelope1D3.vmax = d5;
                envelope.addAttribute(3);
                envelope.a(3, i3, envelope1D3);
            }
            return envelope;
        }
        double d6 = NaN2;
        Point point = new Point();
        if (!isNaN) {
            point.setX(Interop.translateFromAVNaN(d));
            point.setY(Interop.translateFromAVNaN(d2));
        }
        if (z2) {
            point.addAttribute(1);
            if (!isNaN) {
                point.setZ(Interop.translateFromAVNaN(d3));
            }
        }
        if (z3) {
            point.addAttribute(2);
            if (!isNaN) {
                point.setM(Interop.translateFromAVNaN(d6));
            }
        }
        if (z5) {
            point.addAttribute(3);
            if (!isNaN) {
                point.a(i10);
            }
        }
        return point;
    }
}
